<template>
  <common-dialog dialog-title="模型发布信息" :visible.sync="visible"
                 :before-close="handleBeforeClose" v-draggable
                  width="95%" custom-class="model-published-table-data">
    <template #body>
      <model-published-table-data @view-detail="viewDetail"></model-published-table-data>
      <model-published-detail :published-info="publishedInfo" @closed="hidedDetail" v-if="showDetail"></model-published-detail>
    </template>
  </common-dialog>
</template>

<script>

import CommonDialog from '@/components/common/CommonDialog'
import FormMixins from '@/components/mixins/form/FormMixins'
import ModelPublishedTableData from '@/components/model/ModelPublishedTableData'
import ModelPublishedDetail from '@/components/model/ModelPublishedDetail'

export default {
  name: 'ViewPublishedInfo',
  components: {
    CommonDialog,
    ModelPublishedTableData,
    ModelPublishedDetail
  },
  mixins: [FormMixins],
  data(){
    return {
      publishedInfo: undefined,
      showDetail: false
    }
  },
  methods: {
    viewDetail(data){
      this.publishedInfo = data
      this.showDetail = true
    },
    hidedDetail(){
      this.publishedInfo = undefined
      this.showDetail = false
    }
  }
}
</script>

<style lang="less">
  .model-published-table-data {
    .calcHeight(40px);
    overflow-y: hidden !important;

    .el-dialog__body {
      .calcHeight(54px);
      padding-bottom: 0;
      padding-top: 0;
    }
  }
</style>
